SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO




CREATE PROCEDURE dbo.[DnnProduct_Journal_DeleteByKey]
@PortalId int,
@ObjectKey nvarchar(255) 
AS
DECLARE @JournalId int
SET @JournalId = (SELECT JournalId FROM dbo.[DnnProduct_Journal] WHERE PortalId = @PortalId AND ObjectKey = @ObjectKey AND @ObjectKey <> '' AND ObjectKey IS NOT NULL)
IF @JournalId > 0
BEGIN
DELETE FROM dbo.[DnnProduct_Journal_Security] WHERE JournalId = @JournalId
DELETE FROM dbo.[DnnProduct_Journal_Comments] WHERE JournalId = @JournalId
DELETE FROM dbo.[DnnProduct_Journal] WHERE JournalId = @JournalId
END


GO
